<template>
  <div class="box" @click="toGoodsDetail">
    <div style="flex:1;">
      <img style="margin: 0;padding: 0;" class="hot" :src="type=='hot'?hot:type=='news'?news:discount" />
      <img
          style="width: 100%; height: 100px"
          src="../../assets/img/other/hotIcon.png"
          alt=""
      />
    </div>
    <div class="footer">
      <div class="title">黑美人西瓜鲜美多汁2个起卖</div>
      <div style="display:flex;">
        <span style="width:33%" class="price">￥38.88</span>
        <span style="font-size: 10px;width:30%;margin-top:5px;">(起)/个</span>

      </div>
      <div class="sale">销量 9999</div>
      <div >
        <van-rate style="margin-left: 10px;" color="#ffd21e" v-model="value" readonly />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "hotSaleCom",
  data() {
    return {
      value:5,
      hot:require('@/assets/img/other/hot.png'),
      news:require('@/assets/img/other/new.png'),
      discount:require('@/assets/img/other/discount.png')
    }
  },
  props:["type"],
  mounted() {
    // console.log(this.type);
  },
  methods:{
    toGoodsDetail(){
      this.$router.push('/goodsDetail')
    }
  }
};
</script>

<style lang="less" scoped>
.box {
 display: flex;
  margin: 5%;
  height: 100px;
  position: relative;

  .hot {
    position: absolute;
    top: 0;
  }
  .footer {
    flex: 1;
    width: 100%;
    margin-left: -5px;
    box-sizing: border-box;
    //height: 158px;
    border: 1px solid rgb(228, 217, 217);
    border-left: none;
    .title {
      margin-top: 10px;
      font-size:10px;
      margin-left: 10px;
    }
    .price {
      margin-top: 5px;
      margin-left: 10px;
      font-size: 10px;
      font-weight: bold;
      color: red;
    }
    .sale {
      margin-top: 5px;
      margin-left: 10px;
      color: gray;
      width: 34%;
      font-size: 10px;
      flex:1
    }
  }
}
</style>
